package com.yunji.base.service;

import com.yunji.base.bo.BelongAmountModifyBO;
import com.yunji.base.bo.BelongSelectQueryBO;
import com.yunji.base.dao.IBelongDao;
import com.yunji.base.domain.BelongDO;
import com.yunji.base.params.BelongPageParam;
import com.yunji.base.params.BelongSearchParam;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * @Package com.yunji.user.service.impl
 * FileName:	BelongServiceImpl.java
 * Copyright:	Copyright © 2024 All Rights Reserved
 * Company:		云集互联
 * @version: 1.0
 * @since: JDK 1.8.0_202
 * Create at:   2024-08-15 17:58:06.945
 * Description:
 * 所属信息接口实现
 * Modification History:
 * Author					Date						Version			Description
 * --------------------------------------------------------------------------------
 * HuaAo				2024-08-15 17:58:06			1.0				1.0 Version
 */
@Service
public class BelongService {
    @Resource
    IBelongDao belongDao;

    public boolean create(BelongDO belong) {
        return belongDao.save(belong);
    }

    public boolean delete(List<Long> belongIdList) {
        return belongDao.removeBatchByIds(belongIdList);
    }

    public boolean delete(Set<Long> belongIdSet) {
        return belongDao.removeBatchByIds(belongIdSet);
    }

    public boolean deleteById(Long belongId) {
        return belongDao.removeById(belongId);
    }

    public List<BelongDO> listByIds(List<Long> belongIds) {
        return belongDao.listByIds(belongIds);
    }

    public List<BelongDO> listByAgentIds(List<Long> agentIds) {
        return belongDao.listByAgentIds(null, agentIds);
    }

    public List<BelongDO> listByAgentIds(String roleType, List<Long> agentIds) {
        return belongDao.listByAgentIds(roleType, agentIds);
    }

    public List<BelongDO> listByAgentId(String roleType, Long agentId) {
        return belongDao.listByAgentIds(roleType, agentId);
    }

    public List<BelongDO> listByAgentId(Long agentId) {
        return belongDao.listByAgentIds(null, agentId);
    }

    public BelongDO getById(Long belongId) {
        return belongDao.getById(belongId);
    }

    public boolean update(BelongDO belong) {
        return belongDao.updateById(belong);
    }

    public List<BelongDO> list() {
        return belongDao.list();
    }

    public boolean updateAccount(BelongAmountModifyBO belong) {
        return belongDao.updateAccount(belong);
    }

    public List<String> searchTableField(BelongSearchParam param) {
        return belongDao.searchTableField(param);
    }

    public Integer selectStockStatus(Long belongId) {
        return belongDao.selectStockStatus(belongId);
    }

    public List<BelongDO> listByPid(String roleType, Long pid) {
        return belongDao.listByPid(roleType, pid);
    }

    public List<BelongDO> listByPid(Long pid) {
        return listByPid(null, pid);
    }

    public BelongDO getBySiteId(String roleType, Long siteId) {
        return belongDao.getBySiteId(roleType, siteId);
    }

    public BelongDO getByAgentId(String roleType, Long agentId) {
        return belongDao.getByAgentId(roleType, agentId);
    }

    public BelongDO getBySiteId(Long siteId) {
        return belongDao.getBySiteId(null, siteId);
    }

    public BelongDO getByAgentId(Long agentId) {
        return belongDao.getByAgentId(null, agentId);
    }

    public Long[] getSiteIdsById(Long belongId) {
        List<Long> siteIdsById = belongDao.getSiteIdsById(belongId);
        return siteIdsById.toArray(new Long[0]);
    }

    public List<BelongDO> getByBelongType(String belongType) {
        return belongDao.getByBelongType(belongType);
    }

    public List<BelongDO> listById(String belongType, Long belongId) {
        return belongDao.listById(belongType, belongId);
    }

    public List<BelongDO> search(BelongPageParam belong) {
        return belongDao.search(belong);
    }

    public List<BelongDO> getByScaleType(Integer scaleType) {
        return belongDao.getByScaleType(scaleType);
    }

    public BelongDO select(BelongSelectQueryBO bo) {
        return belongDao.select(bo);
    }
}
